import type { InjectionKey } from 'vue';
import { createContext, useContext } from '@vc/use';

/**
 * @description 菜单中的 context
 * @author wfd
 * @date 2021-07-21 14:52:44
 */
export interface F9ContextProps {
  companyId: string;
}

const key: InjectionKey<F9ContextProps> = Symbol();

export function createF9Context(context: F9ContextProps) {
  return createContext<F9ContextProps>(context, key);
}

export function useF9Context() {
  return useContext<F9ContextProps>(key);
}
